﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ALApps.Graphics.Interface;
using ALApps.Graphics.Interface.Engine;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System.IO;

namespace SunRayEngine.MapEditor.Interface
{
    public sealed class InterfaceHandler
    {
        //Defining the path lists needed.
        private List<string> scriptPaths;
        private List<string> designPaths;
        private InterfaceEngine engine; //Defining the engine.

        /// <summary>
        /// Setup the engine
        /// </summary>
        /// <param name="game">The game that we add the engine to</param>
        /// <param name="spriteBatch">The spriteBatch the engine will use for drawing</param>
        public InterfaceHandler(Game game, SpriteBatch spriteBatch)
        {
            InterfaceEngine.GlobalScriptPath = Directory.GetCurrentDirectory().Replace(@"\bin\x86\Debug", "") + @"\Interface\Scripts\"; //Set the scriptPath
            InterfaceEngine.GlobalDesignPath = Directory.GetCurrentDirectory().Replace(@"\bin\x86\Debug", "") + @"\Interface\Design\"; //Set the designPath

            string scriptListPath = InterfaceEngine.GlobalScriptPath.Replace("Scripts\\", "Scripts.txt");
            string designListPath = InterfaceEngine.GlobalScriptPath.Replace("Scripts\\", "Designs.txt");

            scriptPaths = new List<string>();
            designPaths = new List<string>();

            scriptPaths.Add("__init__.py");
            scriptPaths.Add("Top/ButtonEvents.py");

            designPaths.Add("Top.xml");

            engine = new InterfaceEngine(game, spriteBatch, scriptListPath, designListPath, "defaultFont");
            game.Components.Add(engine);
        }
    }
}
